package com.sicheng.lc.周赛.分类.图论;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/6/23 22:26
 */
public class 公园规划 {
    //https://leetcode.cn/contest/cmbchina-2022spring/problems/ReWLAw/
    public int numFlowers(int[][] roads) {

        List<Integer>[] g = new ArrayList[roads.length + 1];
        Arrays.setAll(g, k -> new ArrayList<>());
        for (int[] road : roads) {
            g[road[0]].add(road[1]);
            g[road[1]].add(road[0]);
        }

        int res = 0;
        for (List<Integer> integers : g) {
            res = Math.max(res, integers.size());
        }

        return res;
    }

    public static void main(String[] args) {
        公园规划 solution = new 公园规划();

    }
}
